package com.eascs.workflow.log;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;
import com.eascs.workflow.common.entity.sys.UserLogEntity;
import com.eascs.workflow.common.service.ProxyMongoService;
import com.eascs.workflow.common.service.sys.UserLogService;

@Service
public class UserLogServiceImpl implements UserLogService {

	@Autowired
	UserLogDao userLogDao;

	@Autowired
	ProxyMongoService proxyMongoService;

	public PageResult<UserLogEntity> queryPage(PageResult<UserLogEntity> page) {
		String sql = "select * from o2o_user_log";
		SqlPageQuery<UserLogEntity> pageQuery = new SqlPageQuery<UserLogEntity>(UserLogEntity.class, page.getPageSize(), page.getPageIndex(), sql);
		PageResult<UserLogEntity> result = userLogDao.findDataWithPage(pageQuery);
		return result;
	}

	public UserLogEntity writeLog(UserLogEntity userLogEntity) {
		proxyMongoService.insert(userLogEntity);
		return userLogEntity;
	}
}
